package com.fiberhome.nas.core.model.entity

import android.net.Uri
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import java.util.Date

/**
 * 相册模型
 */
@Serializable
data class AlbumInfo(
    @SerialName("albumName") val albumName: String = "",    //相册名称
    @SerialName("description") val description: String = "",    //相册描述
    @SerialName("albumThumbnailAssetId") val albumThumbnailAssetId: String = "",    //相册缩略图 Id
    @SerialName("createdAt") val createdAt: String = "",    //创建时间戳
    @SerialName("updatedAt") val updatedAt: String = "",    //更新时间戳
    @SerialName("id") val id: String = "",  //相册 ID
    @SerialName("ownerId") val ownerId: String = "",    //拥有者 ID
    @SerialName("albumUsers") val albumUsers: MutableList<String> = mutableListOf(),  //相册用户
    @SerialName("shared") val shared: Boolean = false,  //是否共享
    @SerialName("hasSharedLink") val hasSharedLink: Boolean = false,    //是否有共享连接
    @SerialName("startDate") val startDate: String = "",    //开始日期
    @SerialName("endDate") val endDate: String = "",    //结束日期
    @SerialName("assetCount") val assetCount: Int = 0,  //文件数量
    @SerialName("order") val order: String = "",    //排序，desc 降序，asc，升序
    @SerialName("lastModifiedAssetTimestamp") val lastModifiedAssetTimestamp: String = "",    //最后修改时间
) {

    fun getAlbumType(): AlbumType {
        return when (id) {
            "1" -> AlbumType.ALL
            "2" -> AlbumType.VIDEO
            "3" -> AlbumType.FAVORITE
            else -> AlbumType.CUSTOM
        }
    }
}

enum class AlbumType {
    ALL,
    VIDEO,
    FAVORITE,
    CUSTOM,
    CLOUD
}


// 本地相册数据类
data class LocalAlbum(
    val bucketId: String,
    val albumName: String,
    val coverUri: Uri,
    val photoCount: Int,
    val videoCount: Int,
    val lastModified: Date
) {
    fun getTotalCount(): Int {
        return photoCount + videoCount
    }
}
